<template>
	<view class="container">
		<view class="containerBackground">
			<u-navbar  :autoBack="true" leftIcon="close"  leftIconColor="#FFFFFF" bgColor="transparent" @leftClick="completeTask">
				<template #center >
					<view style="color: #ffffff;">{{title}}</view>
				</template>
			</u-navbar>
			<view style="height: 74px;"></view>
			<view class="containerBackground-number">{{Math.floor(taskObj.score)}}</view>
			<view class="containerBackground-better">You can do better</view>
			<view class="containerBackground-submitTask">
				<view>作业提交成功</view>
				<img src="@/assets/phoneticPractice/完成@3x.png" />
			</view>
		</view>
		<view class="containerTask">
			<view class="containerTask-context">
				<view>单词个数</view>
				<view>{{taskObj.question_num}}</view>
			</view>
			<view class="containerTask-context">
				<view>跟读用时</view>
				<view>{{taskObj.use_time}}</view>
			</view>
			<view class="containerTask-context" @click="goWrongQuestion">
				<view>查看详情</view>
				<view>
					<img src="@/assets/phoneticPractice/跳转箭头@3x.png" />
				</view>
			</view>
			<view class="containerTask-button" @click="completeTask">完成</view>
		</view>
	</view>

</template>

<script setup>
	export default {
		data() {
			return {
				title: null,
				taskObj: {}
			}
		},
		onLoad(options) {
			if (options && options.title) {
				this.title = options.title
				uni.setNavigationBarTitle({
					title: this.title
				})
				let phoneticPractice = uni.getStorageSync('phoneticPracticeWord')
				this.taskObj = JSON.parse(phoneticPractice)
			}
		},
		methods: {
			//完成任务
			completeTask() {
				uni.removeStorage({
					key: 'phoneticPracticeWord'
				})
				uni.redirectTo({
					url:'/pages/phoneticPractice/list'
				})
			},
			goWrongQuestion() {
				uni.navigateTo({
					url: '/pages/phoneticPractice/wrongQuestion?title=' + this.title
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.container {
		background: #F5F5F5;
		height: 100%;

		.containerBackground {
			color: #FFFFFF;
			background: url('@/assets/phoneticPractice/背景@3x.png');
			background-size: contain;
			height: 375px;
			text-align: center;

			.containerBackground-number {
				font-size: 66px;
				// margin-top: 64px;
			}

			.containerBackground-better {
				margin-top: 10px;
				font-size: 18px;
			}

			.containerBackground-submitTask {
				margin-top: 30px;
				font-size: 18px;
				display: flex;
				justify-content: center;
				align-items: center;

				img {
					width: 18px;
					height: 18px;
					margin-left: 10px;
				}
			}
		}

		.containerTask {
			position: relative;
			padding: 0 10px 15px 10px;
			height: 239px;
			color: #333333;
			font-size: 16px;
			line-height: 53px;
			border-radius: 15px;
			background: #ffffff;
			position: relative;
			bottom: 55px;
			margin: 0 10px;

			.containerTask-context {
				border-bottom: 1px solid #E5E5E5;
				display: flex;
				justify-content: space-between;

				img {
					width: 7px;
					height: 12px;
				}
			}

			.containerTask-button {
				width: 300px;
				height: 45px;
				line-height: 45px;
				background: linear-gradient(to left, #29F19C, #02A1F9);
				position: absolute;
				left: 27.5px;
				bottom: 15px;
				text-align: center;
				border-radius: 22.5px;
				font-size: 18px;
				color: #FFFFFF;
			}
		}
	}
</style>